home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9140 < prev    next >
Encoding:
Text File  |  1996-08-05  |  937 b   |  39 lines

  1. Path: mail2news.demon.co.uk!escan.demon.co.uk
  2. From: Bill Birrell <bill@escan.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: HELP on string functions ????
  5. Date: Wed, 06 Mar 1996 22:05:00
  6. Message-ID: <826150130.AA00176@escan.demon.co.uk>
  7. Reply-To: bill@escan.demon.co.uk
  8. X-NNTP-Posting-Host: escan.demon.co.uk
  9. X-Mail2News-Path: escan.demon.co.uk
  10.  
  11.  > Can anybody tell me if there is similar function in
  12.  > place of "strset()" ?
  13.  > Or is there another way of doing this :
  14.  > I need to reinitialize a char pointer during run-time.
  15.  > The statement
  16.  > char *p; p = ""; is causing me problems. I can't use
  17.  > "strset(p,'\0')"
  18.  > because the compiler on the unix machine doesn't
  19.  > recognise the function.
  20.  
  21.     What's wrong with:-
  22.  
  23.     char *p;
  24.     *p='\0'; ?
  25.  
  26.     alternatively you could write a funtion:-
  27.  
  28.     void strset(char *p, char q)
  29.     {
  30.         *p=q;
  31.     }
  32.  
  33.     Ho-hum!
  34.  
  35. --
  36. Regards,
  37. Bill Birrell.
  38. internet:       bill@escan.demon.co.uk
  39.